home *** CD-ROM | disk | FTP | other *** search
- global gMUIObj, gMUIGUIVars
-
- on displayMUIDialog winProps, iconLi, NameLi, EnabLi, ElemLi, xyLi, TextLi, attrLi, valuLi, groupLi
- gMUIObj = new(xtra("MUI"))
- if not objectp(gMUIObj) then
- alert("Couldn't create MUI-Object.")
- exit
- end if
- returnSubst = "¬ù"
- gMUIGUIVars = [#MUIOutputLi: [:], #MUIItemsLi: [], #MUIWidgetsLi: [], #radioGroupWidgets: [], #modal: 1, #aString: EMPTY]
- groupsLi = duplicate(groupLi)
- gMUIGUIVars[#radioGroupWidgets] = duplicate(groupLi)
- MuiWindowProps = GetWindowPropList(gMUIObj)
- MuiWindowProps[#type] = winProps[1]
- MuiWindowProps[#mode] = winProps[2]
- MuiWindowProps[#closeBox] = winProps[3]
- MuiWindowProps[#callback] = winProps[4]
- if winProps.count >= 5 then
- modalDlog = winProps[5]
- else
- modalDlog = 1
- end if
- MuiWindowProps[#modal] = modalDlog
- gMUIGUIVars[#modal] = modalDlog
- MuiWindowProps[#name] = TextLi[#titleBar]
- if voidp(MuiWindowProps.name) then
- MuiWindowProps.name = getaProp(TextLi, #Titelleiste)
- end if
- muiWinWid = xyLi[#BreiteF]
- muiWinHgt = xyLi[#HoeheF]
- xPos = xyLi[#PositionX]
- yPos = xyLi[#PositionY]
- if (xPos = #z) or (yPos = #z) then
- xPos = getWindowCenterH() - (muiWinWid / 2)
- yPos = getWindowCenterV() - (muiWinHgt / 2)
- end if
- if float((the environment)[#productVersion]) > 8.0 then
- MuiWindowProps[#xPosition] = xPos
- MuiWindowProps[#yPosition] = yPos
- else
- MuiWindowProps[#xPosition] = yPos
- MuiWindowProps[#yPosition] = xPos
- end if
- MuiWindowProps[#width] = muiWinWid
- MuiWindowProps[#height] = muiWinHgt
- winOpen = [#value: 0, #type: #WindowBegin, #Attributes: [], #title: "winOpen", #tip: "tip", #width: muiWinWid, #height: muiWinHgt, #enabled: 1]
- groupVOpen = [#value: 0, #type: #GroupVBegin, #Attributes: [], #title: "groupVOpen", #tip: "tip", #width: muiWinWid, #height: muiWinHgt, #enabled: 1]
- groupVClose = [#value: 0, #type: #GroupVEnd, #Attributes: [], #title: "groupVClose", #tip: "tip", #width: muiWinWid, #height: muiWinHgt, #enabled: 1]
- winClose = [#value: 0, #type: #WindowEnd, #Attributes: [], #title: "winClose", #tip: "tip", #width: muiWinWid, #height: muiWinHgt, #enabled: 1]
- gMUIGUIVars[#MUIItemsLi] = [winOpen]
- gMUIGUIVars[#MUIWidgetsLi] = []
- xPosList = xyLi[#xListe]
- yPosList = xyLi[#yListe]
- widthList = xyLi[#bListe]
- heigtList = xyLi[#hListe]
- alignList = xyLi[#aListe]
- styleList = xyLi[#pListe]
- textList = TextLi[#inscription]
- if voidp(textList) then
- textList = TextLi[#Beschriftung]
- end if
- FinetuningY_Pixel_Mac = [#d: 1, #b: 1, #s: -1, #c: 1, #r: 1, #e: -1, #p: 1, #G: 4, #i: 1, #H: 8, #V: 1]
- FinetuningY_Pixel_Win = [#d: 0, #b: 0, #s: -3, #c: 0, #r: 0, #e: 0, #p: 0, #G: 3, #i: 0, #H: 0, #V: 0]
- if the machineType = 256 then
- minusPix = FinetuningY_Pixel_Win
- else
- minusPix = FinetuningY_Pixel_Mac
- end if
- countCRPG = 0
- countE = 0
- countImg = 0
- countBtn = 0
- countImgBeforeBtn = 0
- closeGroupAtWidgetNum = 0
- repeat with i = 1 to ElemLi.count
- widgetName = NameLi[i]
- typ = ElemLi[i]
- if (typ = #r) and (count(groupsLi) > 0) and (closeGroupAtWidgetNum = 0) then
- group = getPropAt(groupsLi, 1)
- radios = groupsLi[1]
- closeGroupAtWidgetNum = getLast(radios)
- add(gMUIGUIVars[#MUIItemsLi], groupVOpen)
- deleteProp(groupsLi, group)
- end if
- props = duplicate(getEmptyMUIPropList(typ))
- props[#name] = widgetName
- props[#realNum] = i - countImg
- if ilk(EnabLi, #propList) then
- props[#enabled] = EnabLi[widgetName]
- else
- props[#enabled] = EnabLi[i]
- end if
- props[#locH] = xPosList[i]
- y = yPosList[i] - minusPix[typ]
- if ((typ = #e) or (typ = #s)) and (styleList[i] = #tiny) and (the machineType <> 256) then
- y = y + 1
- end if
- props[#locV] = y
- props[#width] = widthList[i]
- H = heigtList[i]
- if (typ = #d) or (typ = #b) then
- countBtn = countBtn + 1
- end if
- if the machineType = 256 then
- if ((typ = #d) or (typ = #b)) and (H = 20) then
- H = H + 3
- else
- if typ = #G then
- attr = attrLi.getProp(i)
- styleAttr = attr[#sliderStyle]
- if styleAttr = [#ticks] then
- H = 30
- end if
- end if
- end if
- end if
- props[#height] = H
- if getOne([#r, #c, #p, #G], typ) then
- countCRPG = countCRPG + 1
- if ilk(valuLi, #propList) then
- props[#value] = valuLi[widgetName]
- else
- props[#value] = valuLi[countCRPG]
- end if
- end if
- if getOne([#e, #s], typ) then
- if typ = #e then
- countE = countE + 1
- curName = props[#title]
- nowName = curName && countE
- props[#title] = nowName
- end if
- props[#value] = textList[i - countImg]
- if typ = #s then
- txt = getReplacedText(txt, returnSubst, RETURN)
- end if
- else
- if typ = #i then
- countImg = countImg + 1
- if countBtn = 0 then
- countImgBeforeBtn = countImgBeforeBtn + 1
- end if
- iconTyp = getPropAt(iconLi, countImg)
- if (iconTyp = #mem) or (iconTyp = #GUI) then
- if (the activeWindow = the stage) or (iconTyp = #GUI) then
- theMem = iconLi[countImg]
- else
- preview = "IconPreview" && countImg
- theMem = member(preview)
- end if
- if iconTyp = #mem then
- stageMem = iconLi[countImg]
- noMem = getNoStageMem(stageMem)
- if noMem then
- Info = ["Missing", "Wrong"][noMem]
- alert(Info && "member for icon:" & RETURN & stageMem)
- end if
- end if
- props[#value] = theMem
- end if
- else
- if getOne([#d, #b, #c, #r], typ) > 0 then
- props[#title] = textList[i - countImg]
- else
- props[#title] = "Unnamed"
- end if
- end if
- end if
- case typ of
- #e, #s:
- attr = [#textAlign: alignList[i]]
- if styleList[i] <> 0 then
- attr[#textSize] = styleList[i]
- end if
- props[#Attributes] = attr
- #i:
- if getPropAt(iconLi, countImg) = #sys then
- props[#Attributes] = [#bitmapIcon: iconLi[countImg]]
- end if
- #p:
- attr = attrLi.getProp(i)
- props[#title] = "Pop"
- if attr.count = 0 then
- attr = ["<No values>"]
- end if
- props[#Attributes] = [#valueList: attr]
- #G:
- attr = attrLi.getProp(i)
- styleAttr = attr[#sliderStyle]
- sliderTyp = attr[#sliderTyp]
- RangeAttr = attr[#valueRange]
- muiAttr = [#valueRange: [#min: RangeAttr[1], #max: RangeAttr[2]], #increment: RangeAttr[3], #jump: RangeAttr[4], #acceleration: RangeAttr[5], #sliderStyle: styleAttr]
- props[#type] = sliderTyp
- props[#Attributes] = muiAttr
- end case
- add(gMUIGUIVars[#MUIItemsLi], props)
- add(gMUIGUIVars[#MUIWidgetsLi], props)
- if typ = #r then
- if closeGroupAtWidgetNum = i then
- add(gMUIGUIVars[#MUIItemsLi], groupVClose)
- closeGroupAtWidgetNum = 0
- end if
- end if
- if getOne([#e, #p, #G, #c, #r], typ) > 0 then
- gMUIGUIVars[#MUIOutputLi][props[#name]] = props[#value]
- end if
- end repeat
- add(gMUIGUIVars[#MUIItemsLi], winClose)
- Initialize(gMUIObj, [#windowPropList: MuiWindowProps, #windowItemList: gMUIGUIVars[#MUIItemsLi]])
- clickElemNum = Run(gMUIObj)
- if MuiWindowProps.modal then
- if clickElemNum < 0 then
- alert("MUI-Error. Return value =" && QUOTE & clickElemNum & QUOTE)
- return [-1]
- else
- if clickElemNum = 0 then
- gMUIObj = 0
- return [0]
- else
- BtnProps = gMUIGUIVars[#MUIItemsLi][clickElemNum]
- txt = BtnProps[#title]
- gMUIObj = 0
- return [clickElemNum - countImgBeforeBtn - 1, txt, gMUIGUIVars[#MUIOutputLi]]
- end if
- end if
- else
- WindowOperation(gMUIObj, #show)
- end if
- end
-
- on muiCallbackStandard event, eventData, itemPropList
- if not symbolp(event) then
- exit
- end if
- typ = itemPropList[#type]
- currName = gMUIGUIVars[#MUIItemsLi][eventData][#name]
- currNum = gMUIGUIVars[#MUIItemsLi][eventData][#realNum]
- val = itemPropList[#value]
- case event of
- #itemChanged:
- if typ = #radioButton then
- muiCallBackRadiobuttonBehavior(currName, currNum)
- else
- gMUIGUIVars[#MUIOutputLi][currName] = val
- end if
- #itemClicked:
- if (typ = #defaultPushButton) or (typ = #pushButton) then
- muiKillDialog(eventData, currName)
- end if
- end case
- end
-
- on muiKillDialog eventData, widName
- if gMUIGUIVars[#modal] then
- stop(gMUIObj, eventData)
- else
- gMUIGUIVars[#MUIOutputLi][widName] = #muiClosed
- WindowOperation(gMUIObj, #Hide)
- end if
- end
-
- on muiCallBackRadiobuttonBehavior currName, currNum
- repeat with i = 1 to gMUIGUIVars[#radioGroupWidgets].count
- grp = gMUIGUIVars[#radioGroupWidgets].getPropAt(i)
- rds = gMUIGUIVars[#radioGroupWidgets][i]
- Pos = getOne(rds, currNum)
- if Pos > 0 then
- repeat with widget in rds
- theName = gMUIGUIVars[#MUIWidgetsLi][widget][#name]
- gMUIGUIVars[#MUIOutputLi][theName] = 0
- end repeat
- gMUIGUIVars[#MUIOutputLi][currName] = 1
- exit repeat
- end if
- end repeat
- end
-
- on getEmptyMUIPropList typ
- case typ of
- #d:
- return [#value: EMPTY, #type: #defaultPushButton, #Attributes: [], #title: EMPTY, #tip: "tip", #locH: 0, #locV: 0, #width: 0, #height: 0, #enabled: 1]
- #b:
- return [#value: EMPTY, #type: #pushButton, #Attributes: [], #title: EMPTY, #tip: "tip", #locH: 0, #locV: 0, #width: 0, #height: 0, #enabled: 1]
- #s:
- return [#value: EMPTY, #type: #label, #Attributes: [], #title: "S", #tip: "tip", #locH: 0, #locV: 0, #width: 0, #height: 0, #enabled: 1]
- #e:
- return [#value: EMPTY, #type: #editText, #Attributes: [], #title: "E", #tip: "tip", #locH: 0, #locV: 0, #width: 0, #height: 0, #enabled: 1]
- #i:
- return [#value: 0, #type: #bitmap, #Attributes: [], #title: "Icon", #tip: "tip", #locH: 0, #locV: 0, #width: 0, #height: 0, #enabled: 1]
- #c:
- return [#value: 0, #type: #checkBox, #Attributes: [], #title: EMPTY, #tip: "Tip", #locH: 0, #locV: 0, #width: 0, #height: 0, #enabled: 1]
- #r:
- return [#value: 0, #type: #radioButton, #Attributes: [], #title: EMPTY, #tip: "Tip", #locH: 0, #locV: 0, #width: 0, #height: 0, #enabled: 1]
- #p:
- return [#value: EMPTY, #type: #PopupList, #Attributes: [], #title: EMPTY, #tip: "tip", #locH: 0, #locV: 0, #width: 0, #height: 0, #enabled: 1]
- #G:
- return [#value: 0, #type: #IntegerSliderH, #Attributes: [], #title: EMPTY, #tip: "tip", #locH: 0, #locV: 0, #width: 0, #height: 0, #enabled: 1]
- #H:
- return [#value: EMPTY, #type: #dividerH, #Attributes: [], #title: EMPTY, #tip: "tip", #locH: 0, #locV: 0, #width: 0, #height: 0, #enabled: 1]
- #V:
- return [#value: EMPTY, #type: #dividerV, #Attributes: [], #title: EMPTY, #tip: "tip", #locH: 0, #locV: 0, #width: 0, #height: 0, #enabled: 1]
- end case
- end
-
- on getMUIGUIDlogText BtnsLi, StatLi, EditLi
- inscription = []
- repeat with i = 1 to BtnsLi.count
- add(inscription, BtnsLi[i])
- end repeat
- repeat with i = 1 to EditLi.count
- add(inscription, EditLi[i])
- end repeat
- repeat with i = 1 to StatLi.count
- add(inscription, StatLi[i])
- end repeat
- return inscription
- end
-
- on getMuiIconSize iconLi, iNum, mode
- if mode = #x then
- return member(iconLi[iNum]).width
- else
- return member(iconLi[iNum]).height
- end if
- end
-
- on getReplacedText givenTxt, searchString, newString
- repeat while givenTxt contains searchString
- c = offset(searchString, givenTxt)
- put newString into char c to c + the length of searchString - 1 of givenTxt
- end repeat
- return givenTxt
- end
-
- on getNoStageMem theMem
- if theMem = 0 then
- return 1
- end if
- tell the stage
- if theMem.type = #empty then
- return 1
- end if
- if theMem.type <> #bitmap then
- return 2
- end if
- end tell
- return 0
- end
-
- on getWindowCenterH
- return (the activeWindow).rect.left + ((the activeWindow).rect.width / 2)
- end
-
- on getWindowCenterV
- return (the activeWindow).rect.top + ((the activeWindow).rect.height / 2)
- end
-